package cn.wolfcode.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import cn.wolfcode.business.domain.vo.StatementItemVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import cn.wolfcode.common.annotation.Log;
import cn.wolfcode.common.core.controller.BaseController;
import cn.wolfcode.common.core.domain.AjaxResult;
import cn.wolfcode.common.enums.BusinessType;
import cn.wolfcode.business.domain.BusStatementItem;
import cn.wolfcode.business.service.IBusStatementItemService;
import cn.wolfcode.common.utils.poi.ExcelUtil;
import cn.wolfcode.common.core.page.TableDataInfo;

/**
 * 保存功能
 *
 * @author ruoyi
 * @date 2025-09-23
 */
@RestController
@RequestMapping("/business/item")

public class BusStatementItemController extends BaseController {
    @Autowired
    private IBusStatementItemService busStatementItemService;

    // 保存功能  实现 结算单折扣价 结算单明细集合
    @PostMapping
    public AjaxResult statementItemSave(@RequestBody StatementItemVO vo) {
        return toAjax(busStatementItemService.insertBusStatementItem(vo));
    }

    // 结算单明细 查询 功能
    @GetMapping
    public AjaxResult getStatementItemList(Long statementId) {
        return AjaxResult.success(busStatementItemService.getStatementItemList(statementId));

    }
//结算单明细 支付功能

    @PatchMapping("/{statementId}")
    public AjaxResult pay(@PathVariable Long statementId) {
        return toAjax(busStatementItemService.pay(statementId));
    }
}
